package cn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import cn.exception.NameException;
import cn.exception.PwdException;
@Controller
public class BaseController {
	@ExceptionHandler(NameException.class)
	public ModelAndView HandlerNameException(Exception ex){
		ModelAndView mv=new ModelAndView();
		mv.addObject("ex", ex);
		mv.setViewName("nameerroe.jsp");
		return mv;
	}
	@ExceptionHandler(PwdException.class)
	public ModelAndView HandlerPwdException(Exception ex){
		ModelAndView mv=new ModelAndView();
		mv.addObject("ex", ex);
		mv.setViewName("pwderror.jsp");
		return mv;
	}
	@ExceptionHandler(Exception.class)
	public ModelAndView HandlerException(Exception ex){
		ModelAndView mv=new ModelAndView();
		mv.addObject("ex", ex);
		mv.setViewName("error.jsp");
		return mv;
	}
	
	
	
	
}
